﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using qiupeng.Public;
using System.IO;

public partial class OpenWindows_jigou : System.Web.UI.Page
{
    Db List = new Db();
    public static string showtitle;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            BindTree(ListTreeView.Nodes, 23);
           // List.QuanXianVis(ListTreeView, "aaaa1d", Session["perstr"].ToString());


            string SQL_GetList = "select * from qp_hr_JiGou ";
            OleDbDataReader MyReader = List.GetList(SQL_GetList);
            if (MyReader.Read())
            {
                showtitle = "";
            }
            else
            {
                showtitle = "未找到机构名称，请在机构管理中设置";
            }
            MyReader.Close();

        }









    }

    private void BindTree(TreeNodeCollection Nds, int IDStr)
    {
        string sql = "select id,jgname from qp_hr_JiGou where id in (" + this.Session["bmqxa"].ToString().Trim() + ") and ParentNodesID=" + IDStr.ToString() + "     order by paixu,id asc";
        OleDbDataReader list = this.List.GetList(sql);
        while (list.Read())
        {
            if (IDStr == 0)
            {
                TreeNode child = new TreeNode();
                child.Text = " " + list["JgName"].ToString();
                child.Value = list["ID"].ToString();
                int iDStr = int.Parse(list["ID"].ToString());
                child.ImageUrl = "../images/menu/zhu.gif";
                child.NavigateUrl = "jigoumc.aspx?id=" + iDStr;
                child.Expanded = true;
                child.Target = "rform";
                Nds.Add(child);
                this.BindTree(Nds[Nds.Count - 1].ChildNodes, iDStr);
            }
            else
            {
                TreeNode node2 = new TreeNode();
                node2.Text = " " + list["JgName"].ToString();
                node2.Value = list["ID"].ToString();
                int num2 = int.Parse(list["ID"].ToString());
                node2.ImageUrl = "../images/menu/homepage.gif";
                node2.NavigateUrl = "jigoumc.aspx?id=" + num2;
                node2.Expanded = false;
                node2.Target = "rform";
                Nds.Add(node2);
                this.BindTree(Nds[Nds.Count - 1].ChildNodes, num2);
            }
        }
        list.Close();
    }
}
